#!/usr/bin/guile \
-e main -s
!#

;;  This program tries to find a perfect 3d triangle ie:

;;  A^2 + B^2 + C^2 = D^2


;; use these modules to help my process the command line arguments.
(use-modules (ice-9 getopt-long))
(use-modules (ice-9 regex))


(define (main args)
  ;;the option specification tells getopt-long how
  ;; to parse the command line
  (let* ((option-spec '((version (single-char #\v) (value #f))
                        (help    (single-char #\h) (value #f))
                        (number  (single-char #\n) (value #t)
                                 ;; (required #t)
                                 )))
         ;; tell getopt-long to parse the command line and put the
         ;; data in options
         (options (getopt-long args option-spec))
         ;; was  --help or -h used?
         (help-wanted (option-ref options 'help #f))
         (version-wanted (option-ref options 'version #f))
         ;; was -c or --calc used?  If there was no value given,
         ;; then return #f
         (number-wanted (option-ref options 'number #f)))
    (if (or version-wanted help-wanted)
        (begin
          (if version-wanted
              (display "repeat version 0.1\n"))
          (if help-wanted
              (begin
                (display "repeat [options]\n")
                (display "-v  --version  Display version\n")
                (display "-h, --help     Display this help info\n")
                (display "-n, --number   Does this number repeat?\n")
                )))
        (display "help"))))
